package com;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Looper;
import android.text.TextUtils;

/**
 * 在此写用途
 *
 * @author: zhiwei
 * @date: 2017-10-04 22:46
 * @version: 9.1.0
 */
public class RuntimeGlobals {
    private static Boolean sUidShared;
    private static final Thread sMainThread = Looper.getMainLooper().getThread();

    public RuntimeGlobals() {
    }

    public static boolean isMainThread() {
        return Thread.currentThread() == sMainThread;
    }

    public static boolean isMultiPackageMode(Context context) {
        if(sUidShared == null) {
            try {
                PackageInfo e = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
                sUidShared = Boolean.valueOf(!TextUtils.isEmpty(e.sharedUserId));
            } catch (NameNotFoundException var2) {
                sUidShared = Boolean.valueOf(false);
            }
        }

        return sUidShared.booleanValue();
    }
}
